using GrapeCity.Forguncy.Commands;
using GrapeCity.Forguncy.Plugin;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows.Navigation;

namespace PluginRegion
{
    [Category("实用工具")]
    [OrderWeight(999)]
    [Description("命令组\r\n可选择同步或异步执行")]
    [Icon("pack://application:,,,/PluginRegion;component/Resources/Icon.png")]
    [Designer("PluginRegion.Designer.PluginRegionCommandDesigner, PluginRegion")]
    public class PluginRegionCommand : Command, ISubListCommand, IContainSubCommands
    {
        [Description("同步或异步")]
        [DisplayName("同步或异步")]
        [RadioGroupProperty(ValueList = "同步|异步")]
        public string SyncFlag { get; set; } = "同步";

        [Description("注释的别名")]
        [DisplayName("命令组注释")]
        public string RegionName { get; set; }

        /// <summary>
        /// 子命令
        /// </summary>
        [Browsable(false)]
        public List<Command> CommandList { get; set; } = new List<Command>();

        public IEnumerable<List<Command>> EnumSubCommands()
        {
            yield return CommandList;
        }

        public override string ToString()
        {
            return this.SyncFlag + "命令组 " + this.RegionName;
        }
    }
}
